Telegram Group & Telegram Channel
🧠 Python-хитрая задача + решение

🖍️ Условие:
У тебя есть список логов (user, login/logout).
Найди тех, кто зашел, но не вышел.

📜 Пример:

logs = [
("alice", "login"),
("bob", "login"),
("alice", "logout"),
("dave", "login"),
("bob", "logout"),
("carol", "login"),
("dave", "logout")
]


________
💻 Решение:

from collections import defaultdict

def find_stuck_users(logs):
counter = defaultdict(int)
for user, action in logs:
if action == "login":
counter[user] += 1
elif action == "logout":
counter[user] -= 1
return sorted([user for user, count in counter.items() if count > 0])


🛠Ответ: "carol"

#Python #Challenge #DevPuzzle

@python_job_interview



tg-me.com/python_testit/1161
Create:
Last Update:

🧠 Python-хитрая задача + решение

🖍️ Условие:
У тебя есть список логов (user, login/logout).
Найди тех, кто зашел, но не вышел.

📜 Пример:


logs = [
("alice", "login"),
("bob", "login"),
("alice", "logout"),
("dave", "login"),
("bob", "logout"),
("carol", "login"),
("dave", "logout")
]


________
💻 Решение:

from collections import defaultdict

def find_stuck_users(logs):
counter = defaultdict(int)
for user, action in logs:
if action == "login":
counter[user] += 1
elif action == "logout":
counter[user] -= 1
return sorted([user for user, count in counter.items() if count > 0])


🛠Ответ: "carol"

#Python #Challenge #DevPuzzle

@python_job_interview

BY Python tests


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/python_testit/1161

View MORE
Open in Telegram


Python tests Telegram | DID YOU KNOW?

Date: |

Telegram Be The Next Best SPAC

I have no inside knowledge of a potential stock listing of the popular anti-Whatsapp messaging app, Telegram. But I know this much, judging by most people I talk to, especially crypto investors, if Telegram ever went public, people would gobble it up. I know I would. I’m waiting for it. So is Sergei Sergienko, who claims he owns $800,000 of Telegram’s pre-initial coin offering (ICO) tokens. “If Telegram does a SPAC IPO, there would be demand for this issue. It would probably outstrip the interest we saw during the ICO. Why? Because as of right now Telegram looks like a liberal application that can accept anyone - right after WhatsApp and others have turn on the censorship,” he says.

If riding a bucking bronco is your idea of fun, you’re going to love what the stock market has in store. Consider this past week’s ride a preview.The week’s action didn’t look like much, if you didn’t know better. The Dow Jones Industrial Average rose 213.12 points or 0.6%, while the S&P 500 advanced 0.5%, and the Nasdaq Composite ended little changed.

Python tests from kr


Telegram Python tests
FROM USA